<?php
/**
 * RhinoSlider
 * http://rhinoslider.com/
 *
 * @author danidhsm
 *
 */
class rhinoSlider extends CI_Controls{

	/**
	 *
	 * Enter Array con solo el nombre de la imagen que se le pasará al control
	 * @var array
	 */
	public $images;

	public $speed;
	
	/*
	 * slide,fade,none,kick,transfer,shuffle,explode,turnOver,chewyBars
	 */
	public $effect='slide';
	
	function __construct(){
		parent::__construct();
		$this->images=array();
	}

	function drawContent(){



		$ul= new ul();
		$ul->atributos=$this->atributos;

			
		//creo la estructura

		$imagenes=$this->images;
		$nimagenes=count($imagenes);
		for($i=0;$i<$nimagenes;++$i){
			$li=new li();
			$li->att('id','img_'.$i);
			$li->att('class','rhinosliderli');
			
			$img=new img();
			$img->att('id','img_'.$i);
			$img->att('class','rhinoslider_image');
			$img->att('src',$imagenes[$i]);
			$li->addControl($img);
			$ul->addControl($li);
		}
		
		$this->cloudCarousel_script();
		return $ul;

	}

	private function cloudCarousel_script(){

		$this->CI->dynamic_assets->add_js(base_url('js/vendor/rhinoSlider/rhinoslider-1.05.min.js'));
		$this->CI->dynamic_assets->add_js(base_url('js/vendor/easing.js'));
		$this->CI->dynamic_assets->add_js(base_url('js/vendor/mousewheel.js'));
		
		$this->CI->dynamic_assets->add_css(base_url('js/vendor/rhinoSlider/rhinoslider-1.05.css'));
		
		
		ob_start();
		?>
		<script>

		$(document).ready(function() {
			$('#<?php echo $this->att('id');?>').rhinoslider({
				easing: 'easeInCubic',
				controlsPlayPause: false,
				controlsMousewheel: false,
				autoPlay: true,
				showTime:2500,
				pauseOnHover: false,
				effect:'<?php echo $this->effect; ?>'
			});
		});
			
		</script>
		<?php
		
		$this->CI->dynamic_assets->add_code_js(ob_get_clean());
			
	}
}